package tool

import "reflect"

func Obj2Map(obj interface{}) map[string]interface{}{
	t := reflect.TypeOf(obj)
	v := reflect.ValueOf(obj)
	num:=v.NumField()
	var m = make(map[string]interface{})
	for i:=0;i<num;i++{
		m[t.Field(i).Name] = v.Field(i).Interface()
	}
	return m
}
